//
//  UIButton+Extension.swift
//  iOSwechat
//
//  Created by apple on 16/3/3.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

extension UIButton {
    
    convenience init(title:String , fontSize:CGFloat , imageName:String , bkgimageView:String) {
        
        // 调用当前类的指定构造函数
        self.init()

        setTitleColor(UIColor.lightTextColor(), forState: UIControlState.Normal)
        // 图片
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        // 背景图片
        setBackgroundImage(UIImage(named: bkgimageView), forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named: "\(bkgimageView)_highlighted"), forState: UIControlState.Highlighted)
        // 设置标题内容，颜色，大小
        setTitle(title, forState: UIControlState.Normal)
        titleLabel?.font = UIFont.systemFontOfSize(fontSize)
        setTitleColor(UIColor.lightGrayColor(), forState: UIControlState.Normal)
    }
}
